<?php
include ('function.php');
$user_latitude = floatval($_GET['user_latitude']);
$user_longitude = floatval($_GET['user_longitude']);
$max_km = $_GET['max_km'];

$critere = array('max_km' => $_GET['max_km'], 
                 'sexe' => $_GET['sexe'],
                 'age1' => $_GET['age1'], 
                 'age2' => $_GET['age2'],
                 'poids1' => $_GET['poids1'],
                 'poids2' => $_GET['poids2'],
                 'taille1' => $_GET['taille1'],
                 'taille2' => $_GET['taille2'], 
                 'bonnet' => $_GET['bonnet'], 
                 'mensuration' => $_GET['mensuration'], 
                 'capote' => $_GET['capote'],
                 'hair_color' => $_GET['hair_color']);

$array = find_bitch($critere);
$verified_bitches = array();
              
foreach ($array as $bitch) {
	        	$bitch_latitude = floatval($bitch["latitude"]);
	        	$bitch_longitude = floatval($bitch["longitude"]);

	        	if(distance($user_latitude, $user_longitude, $bitch_latitude, $bitch_longitude, "K") <= $max_km){
	        		array_push($verified_bitches, $bitch);        	
	        	}
	        }

	        echo json_encode($verified_bitches);
	    
	


	
?>

